<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <%include ../../common.ejs%>


    <script type="text/javascript" src="/javascripts/sweet-alert.js"></script>
    <link rel="stylesheet" type="text/css" href="/stylesheets/sweet-alert.css">
    <script type="text/javascript">

         function confirms(id){
             swal({
                         title: "是否删除该用户？",
                         test:"test",
                         type: "warning",
                         showCancelButton: true,
                         confirmButtonColor: '#DD6B55',
                         confirmButtonText: '删除',
                         cancelButtonText: "保留",
                         closeOnConfirm: false,
                         closeOnCancel: true
                     },

                     function(isConfirm){
                         var userId=id;
                         if (isConfirm){
                             swal("Deleted!", "Your imaginary file has been deleted.", "success");
                             window.location.href="delUserList?id="+userId;
                         }
                     });
         };

        function changePageUl(){
//            alert(<%= pageNo %>);
            var pageNo=<%= pageNo %>;
            var li=
            '<li><a href="#">&laquo;</a></li>'+
            '<li <% if(pageNo=='+pageNo+'){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo='+pageNo+'">'+pageNo+'</a></li>'+
            '<li <% if(pageNo=='+(pageNo+1)+'){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo='+(pageNo+1)+'">'+(pageNo+1)+'</a></li>'+
            '<li <% if(pageNo=='+(pageNo+2)+'){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo='+(pageNo+2)+'">'+(pageNo+2)+'</a></li>'+
            '<li <% if(pageNo=='+(pageNo+3)+'){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo='+(pageNo+3)+'">'+(pageNo+3)+'</a></li>'+
            '<li <% if(pageNo=='+(pageNo+4)+'){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo='+(pageNo+4)+'">'+(pageNo+4)+'</a></li>'+
            '<li ><a href="#">&raquo;</a></li>';
            $('#pageUl').html(li);
        }
    </script>
</head>

<body >

<div id="top">
    <% include ../top.ejs%>
</div>
<div class="container-fluid" style="margin-top: 20px;">
    <div class="row">
        <div class="col-md-1">
        </div>
        <!--左侧导航栏开始-->
        <div id="left" class="col-md-2">
            <% include ../left.ejs%>
        </div>
        <!--左侧导航栏结束-->

        <!--右侧正文内容开始-->
        <div class="col-md-8 bodyDiv" id="right">
            <div class="row">
                <div class="col-md-6" >
                    <span class="headTitle">用户列表</span>
                </div>
                <form class="form-horizontal" role="form" method="post">
                    <div class="col-md-2" style="padding-top: 30px;">
                        <select class="form-control">
                            <option value="用户姓名">用户姓名</option>
                        </select>
                    </div>
                    <div class="col-md-2" style="padding-top: 30px;">
                        <input type="text" class="form-control" name="name" placeholder="查询条件">
                    </div>
                    <div class="col-md-2" style="padding-top: 30px;">
                        <input type="submit" class="btn btn-primary"  value="搜索">
                        <button type="button" class="btn btn-primary" onclick="window.location.href='toAddUser'">新增</button>
                    </div>
                </form>
            </div>
            <div class="row">
                <div class="col-md-12" style="height: 330px;min-height: 330px;">
                    <table id="table1" class="table table-striped" style="width: 100%;table-layout:fixed;">
                        <caption></caption>
                        <thead>
                        <tr>
                            <th>用户编号</th>
                            <th>用户姓名</th>
                            <th>性别</th>
                            <th>手机号码</th>
                            <th>邮箱</th>
                            <th>生日</th>
                            <th>地址</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <% if(users!=undefined){%>
                            <% for(var i=0; i<users.length; i++) { %>
                            <tr>
                                <td><%= users[i].id %></td>
                                <td><%= users[i].name %></td>
                                <td><%= (users[i].sex=='F')?'女':'男' %></td>
                                <td><%= users[i].tel %></td>
                                <td title="<%= users[i].email %>"><%= users[i].email %></td>
                                <td><%= users[i].birthday %></td>
                                <td><%= users[i].address %></td>
                                <td><a href="toUpdateUser?id=<%= users[i].id %>">修改</a>&nbsp;</td>
                            </tr>
                            <% } %>
                        <% }else{ %>
                            <tr><td colspan="8" class="text-center"><h1>抱歉 没有符合条件记录</h1></td></tr>
                        <% } %>
                        </tbody>
                    </table>
                    </form>
                </div>
            </div>
            <!--分页开始-->
            <div class="row">
                <div class="col-md-12" style="text-align: center;">
                    <ul class="pagination" id="pageUl">
                        <li><a href="#">&laquo;</a></li>
                        <li <% if(pageNo==1){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo=1">1</a></li>
                        <li <% if(pageNo==2){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo=2">2</a></li>
                        <li <% if(pageNo==3){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo=3">3</a></li>
                        <li <% if(pageNo==4){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo=4">4</a></li>
                        <li <% if(pageNo==5){%>class="active"<% } %>><a href="/admin/peopleManagement/userList?pageNo=5">5</a></li>
                        <li ><a href="#" onclick="changePageUl()">&raquo;</a></li>
                    </ul>
                </div>
            </div>
            <!--分页结束-->
        </div>
        <!--右侧正文内容结束-->
        <div class="col-md-1">
        </div>
    </div>
</div>
</body>
</html>